﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using netEntity = tuReserva.Model;
using tuReserva.Service;

namespace tuReserva.com.Controllers
{
    public class UserController : Controller
    {
		public ActionResult getPartials(string partial)
		{
			return View(partial);
		}

		public JsonResult getUser()
		{
			return Json(Session["User"] as netEntity.User, JsonRequestBehavior.AllowGet);
		}

		[HttpPost]
		public void updateUser(netEntity.User user)
		{
			new ApplicationService().updateUser(user);

			Session["User"] = user;
		}

		public JsonResult getNewUser()
		{
			return Json(new netEntity.User(), JsonRequestBehavior.AllowGet);
		}

		public ActionResult getInsertUserView()
		{
			return View("InsertUser");
		}

		[HttpPost]
		public void insertUser(netEntity.User user)
		{
			new ApplicationService().insertUser(user);
		}
	}
}
